package com.hyp.pay.http;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import retrofit2.http.Query;

/**
 *
 *
 */
public class URLManage {


	public final static String HOST = "https://www.baidu.com/";
	private static AsyncHttpClient client = new AsyncHttpClient();

	static {
		client.setTimeout(11000);
	}

	public static void showInfos(String string, JsonHttpResponseHandler res) {
		String urlString = HOST + "s";
		RequestParams params = new RequestParams();
		params.put("wd", string);
		get(urlString, params, res);
	}

	public static void showInWeinxin(String GoodsName,String Charge, String CreatTime, String Type, String UserId,
									 String AuthCode, String AddIp, JsonHttpResponseHandler res) {
		String urlString = HyqApis.HOST+"wepayScann/WepaySc.do";
		RequestParams params = new RequestParams();
		params.put("GoodsName", GoodsName);
		params.put("Charge", Charge);
		params.put("CreatTime", CreatTime);
		params.put("Type", Type);
		params.put("UserId", UserId);
		params.put("AuthCode", AuthCode);
		params.put("AddIp", AddIp);
		get(urlString, params, res);
	}

	/**
	 *
	 * 
	 * @param urlString
	 * @param params
	 * @param res
	 */
	private static void get(String urlString, RequestParams params, JsonHttpResponseHandler res) {
		 System.out.println((urlString + "?" + params.toString()));
		client.get(urlString, params, res);
	}
}
